package org.boulderfoodrescue.webapp.client.pickuptimes.timepicker;

import java.util.Date;

import com.google.gwt.i18n.shared.DateTimeFormat;

public class Time {
	private int hour;
	private int minute;
	public Time(){}
	public Time(int hour, int minute) {
	  this.setHour(hour);
	  this.setMinute(minute);
  }
	public Time(int minute_count){
		hour = minute_count / 60;
		minute = minute_count%60;
	}
	public int getHour() {
  	return hour;
  }
	public void setHour(int hour) {
  	this.hour = hour;
  }
	public int getMinute() {
  	return minute;
  }
	public void setMinute(int minute) {
  	this.minute = minute;
  }
	public int getMinuteCount(){
		return hour*60+minute;
	}
	public String toStringTimeFull(){
		DateTimeFormat dtf = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_FULL);
		Date date = new Date();
		date.setHours(hour);
		date.setMinutes(minute);
		return dtf.format(date);
	}
	public String toStringTimeLong(){
		DateTimeFormat dtf = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_LONG);
		Date date = new Date();
		date.setHours(hour);
		date.setMinutes(minute);
		return dtf.format(date);
	}
	public String toStringTimeMedium(){
		DateTimeFormat dtf = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_MEDIUM);
		Date date = new Date();
		date.setHours(hour);
		date.setMinutes(minute);
		return dtf.format(date);
	}
	public String toStringTimeShort(){
		DateTimeFormat dtf = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_SHORT);
		Date date = new Date();
		date.setHours(hour);
		date.setMinutes(minute);
		return dtf.format(date);
	}
}
